/*
 * scheduler.h
 *
 * This file is used to schedule threads and run them.
 *
 *  Created on: 13.01.2013
 *      Author: Michael
 */

#ifndef SCHEDULER_H_
#define SCHEDULER_H_

/*
 * ======== Standard includes ========
 */
#include <inttypes.h>

/*
 * ======== Project related includes ========
 */
#include "os/api.h"
#include "extensions/extension.h"

/*
 * Initialize the scheduler.
 * @param exts Description of extensions which should run as thread
 */
void scheduler_init(Extension_t exts);

/*
 * Start a new thread.
 * @param tFunc The function which shall be executed in a thread
 * @return Thread id of the started thread
 */
uint16_t scheduler_startThread(thread_func tFunc);

/*
 * Run the next thread. Next thread is calculated with the chosen algorithm.
 * This method gets called automatically by a timer interrupt (Timer0_A3).
 */
void scheduler_runNextThread(void);

/*
 * Kill the thread with the given id.
 * @param The thread id to kill
 */
void scheduler_killThread(uint16_t threadId);

#endif /* SCHEDULER_H_ */
